#pragma once

#include "console_screen_base.h"
#include <iostream>

class Screen : public console_screen_base<signed char>
{

public:

	Screen(int x, int y, int high, int wide, 
		signed char up = 0, signed char down = 0, 
		signed char left = 0, signed char right = 0,
		signed char top_left = 0, signed char bottom_left = 0,
		signed char top_right = 0, signed char bottom_right = 0)
		:console_screen_base(x, y, high, wide, up, down, left, right,
			top_left, bottom_left, top_right, bottom_right)
	{
		;
	}

	void show()
	{
		printFrame();
	}

	void clean()
	{
		cleanFrame();
	}

protected:

	void printCharUp()
	{
		SetPos(_x + 1, _y);
		for (int wide = 1; wide <= _wide - 2; ++wide)
		{
			std::cout << _up;
		}
	}

	void printCharDown()
	{
		SetPos(_x + 1, _y + _high - 1);
		for (int wide = 1; wide <= _wide - 2; ++wide)
		{
			std::cout << _down;
		}
	}

	void printCharLeft()
	{
		for (int high = 1; high <= _high - 2; ++high)
		{
			SetPos(_x, _y + high);
	
			std::cout << _left;
		}
	}

	void printCharRight()
	{
		for (int high = 1; high <= _high - 2; ++high)
		{
			SetPos(_x + _wide - 1, _y + high);

			std::cout << _right;
		}
	}

	void printCharCorner()
	{
		SetPos(_x, _y);
		std::cout << _top_left;

		SetPos(_x + _wide - 1, _y);
		std::cout << _top_right;

		SetPos(_x, _y + _high - 1);
		std::cout << _bottom_left;

		SetPos(_x + _wide - 1, _y + _high - 1);
		std::cout << _bottom_right;
	}

	void cleanCharUp()
	{
		signed char temp = _up;
		_up = ' ';
		printCharUp();
		_up = temp;
	}

	void cleanCharDown()
	{
		signed char temp = _down;
		_down = ' ';
		printCharDown();
		_down = temp;
	}

	void cleanCharLeft()
	{
		signed char temp = _left;
		_left = ' ';
		printCharLeft();
		_left = temp;
	}

	void cleanCharRight()
	{
		signed char temp = _right;
		_right = ' ';
		printCharRight();
		_right = temp;
	}

	void cleanCharCorner()
	{
		signed char temp1 = _top_left;
		signed char temp2 = _bottom_left;
		signed char temp3 = _top_right;
		signed char temp4 = _bottom_right;

		changeCorner(' ', ' ', ' ', ' ');
		printCharCorner();
		changeCorner(temp1, temp2, temp3, temp4);
	}

};



